package vip.xiaonuo.smzq.modular.kcl.controller;

import javax.annotation.Resource;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import vip.xiaonuo.smzq.modular.kcl.entity.Kslsju;
import vip.xiaonuo.smzq.modular.kcl.entity.param.KslsParam;
import vip.xiaonuo.smzq.modular.kcl.entity.vo.KslsVo;
import vip.xiaonuo.smzq.modular.kcl.service.IKslsjuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.common.pojo.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;


/**
 * 矿山历史记录表
 *
 * @author sqq
 * @since 2024-09-10
 */
@Api(tags = "矿山历史记录表")
@RestController
@RequestMapping("/kcl/kslsju")
@Validated
public class KslsjuController {

    @Resource
    private IKslsjuService iKslsjuService;

    /**
     * 添加矿山历史记录表
     */
    @ApiOperation("添加矿山历史记录表")
    @PostMapping("/add")
    public CommonResult<String> add(@RequestBody @Valid Kslsju kslsju) {
        iKslsjuService.save(kslsju);
        return CommonResult.ok();
    }

    /**
     * 删除矿山历史记录表
     */
    @ApiOperation("删除矿山历史记录表")
    @PostMapping("/deletAllKsLs")
    public CommonResult<String> delete(@RequestBody @Valid Kslsju kslsju) {
        iKslsjuService.removeKls(kslsju);
        return CommonResult.ok();
    }



    /**
     * 编辑矿山历史记录表
     */
    @ApiOperation("添加矿山历史记录表-list")
    @PostMapping("/addAll")
    public CommonResult<String> edit(@RequestBody @Valid KslsVo kslsj) {
        iKslsjuService.addAll(kslsj);
        return CommonResult.ok();
    }

    /**
     * 矿山历史记录表分页查询
     */
    @ApiOperation("矿山历史记录表分页查询")
    @GetMapping("/list")
    public CommonResult<Page<Kslsju>> page() {
        return CommonResult.data(iKslsjuService.page(new Kslsju()));
    }
    /**
     * 矿山历史记录表分查询
     */
    @ApiOperation("矿山历史记录表分查询")
    @PostMapping("/getPageList")
    public CommonResult<Page<KslsVo>> getList(@RequestBody @Valid KslsParam kslsju) {
        return CommonResult.data(iKslsjuService.getPageList(kslsju));
    }

    /**
     * 矿山历史详情列表
     * @param kslsju
     * @return
     */
    @ApiOperation("矿山历史详情列表")
    @PostMapping("/getList")
    public CommonResult<List<Kslsju>> getDetails(@RequestBody @Valid Kslsju kslsju) {
        return CommonResult.data(iKslsjuService.getDetails(kslsju));
    }








}
